package com.example.spring_blog_24_9_8.config;

import com.example.spring_blog_24_9_8.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public Result  exceptionAdvice(Exception e){
        return Result.fail(-1,e.getMessage());
    }
}
